import React, { Component } from 'react'
import Swiper from 'swiper'
import 'swiper/dist/css/swiper.css'
import './index.less'
export default class index extends Component {
    componentDidMount() {
        var mySwiper = new Swiper(this.container, {
            autoplay: true,//可选选项，自动滑动
            loop: true,
            pagination: {
                el: this.pagination,
            },
        })
    }
    render() {
        let { imgdata } = this.props
        console.log(imgdata);
        return (
            <div className="swiper-container" ref={(container) => { this.container = container }}>
                <div className="swiper-wrapper">
                    {
                        imgdata.map((item, index) => {
                            return (
                                <div className="swiper-slide" key={index}>
                                    <img src={item} />
                                </div>
                            )
                        })
                    }

                </div>
                <div className="swiper-pagination" ref={(pagination) => { this.pagination = pagination }}></div>
            </div>
        )
    }
}
